package com.dmpp.mes.service.impl;


import com.dmpp.mes.bean.ResponseData;
import com.dmpp.mes.dao.ProcessMapper;
import com.dmpp.mes.dao.RoutingMapper;
import com.dmpp.mes.parameterInfo.Process;
import com.dmpp.mes.parameterInfo.Routing;
import com.dmpp.mes.service.ProcessService;
import com.dmpp.mes.service.RoutingService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service(value = "RoutingService")
public class RoutingServiceImpl implements RoutingService {


    @Autowired
    private RoutingMapper mapper;

    @Override
    public ResponseData findAll() {
        ResponseData responseData = new ResponseData();
        PageInfo pageInfo = new PageInfo<>(mapper.findAll());
        responseData.setData(pageInfo);
        return responseData;
    }

    @Override
    public ResponseData findByCode(String code) {
        ResponseData responseData = new ResponseData();
        responseData.setData(mapper.findByCode(code));
        return responseData;
    }

    @Override
    public ResponseData insert(Routing routing) {
        ResponseData responseData = new ResponseData();
        mapper.insert(routing);
        return responseData;
    }

    @Override
    public ResponseData updateById(Routing routing) {
        ResponseData responseData = new ResponseData();
        mapper.updateById(routing);
        return responseData;
    }

    @Override
    public ResponseData delete(String code) {
        ResponseData responseData = new ResponseData();
        mapper.delete(code);
        return responseData;
    }
}
